package com.bee.剑指offer;

/**
 * @version 1.0.0
 * @Author yong.Mr
 * @data 2019-8-9
 */
public class 等差数列求前n项和 {

    public static int digui(int n) {
        if(n == 1) {
            return n;
        }
        return n + digui(n - 1);
    }

    public static int mathCal (int n) {
        int sum = (int)Math.pow(n, 2) + n;
        return sum >> 1;
    }

    public static void main(String[] args) {
        int digui = mathCal(5);
        int count = 10;

        System.out.println(count >> 1);
    }
}
